<template>
  <div class="nation">
    <el-checkbox-group v-model="model.diseaseList">
      <el-checkbox label="1" @change="handlerCheckBox('1')">无</el-checkbox>
      <el-checkbox label="2" @change="handlerCheckBox('2')"
        >高血压 确诊时间</el-checkbox
      >
      <el-input v-model="model.hypertensionDate" style="width:120px" />
      <el-checkbox label="3" @change="handlerCheckBox('3')"
        >糖尿病 确诊时间</el-checkbox
      >
      <el-input v-model="model.diabetesDate" style="width:120px" />
      <el-checkbox label="4" @change="handlerCheckBox('4')"
        >冠心病 确诊时间</el-checkbox
      >
      <el-input v-model="model.coronaryDate" style="width:120px" />

      <el-checkbox label="5" @change="handlerCheckBox('5')"
        >慢性阻塞性肺疾病 确诊时间</el-checkbox
      >
      <el-input v-model="model.manxinDate" style="width:120px" />
      <el-checkbox label="6" @change="handlerCheckBox('6')"
        >恶性肿瘤 确诊时间</el-checkbox
      >
      <el-input v-model="model.tumourDate" style="width:120px" />
      <el-checkbox label="7" @change="handlerCheckBox('7')"
        >脑卒中 确诊时间</el-checkbox
      >
      <el-input v-model="model.strokeDate" style="width:120px" />
      <el-checkbox label="8" @change="handlerCheckBox('8')"
        >严重精神障碍 确诊时间</el-checkbox
      >
      <el-input v-model="model.mentalDate" style="width:120px" />
      <el-checkbox label="9" @change="handlerCheckBox('9')"
        >结核病 确诊时间</el-checkbox
      >
      <el-input v-model="model.tuberculosisDate" style="width:120px" />
      <el-checkbox label="10" @change="handlerCheckBox('10')"
        >肝炎 确诊时间</el-checkbox
      >
      <el-input v-model="model.pneumoniaDate" style="width:120px" />
      <el-checkbox label="11" @change="handlerCheckBox('11')"
        >先天畸形 确诊时间</el-checkbox
      >
      <el-input v-model="model.pneumoniaDate" style="width:120px" />
      <el-checkbox label="12" @change="handlerCheckBox('12')"
        >职业病 确诊时间</el-checkbox
      >
      <el-input v-model="model.occupationDate" style="width:120px" />

      <el-checkbox label="98" @change="handlerCheckBox('98')"
        >其他法定传染病 确诊时间</el-checkbox
      >
      <el-input v-model="model.legalDate" style="width:120px" />

      <el-checkbox label="99" @change="handlerCheckBox('99')">其他</el-checkbox>
      <el-input v-model="model.diseaseValue" style="width:120px" />
      <label>
        <span class="el-checkbox__label fontColor">确诊时间</span>
      </label>
      <el-input v-model="model.otherDate" style="width:120px" />
    </el-checkbox-group>
  </div>
</template>

<script>
export default {
  props: {
    model: {
      type: Object,
      default: () => {}
    }
  },
  data() {
    return {}
  },
  methods: {
    handlerCheckBox(value) {
      // console.log(value)
      const emptyVal = "1"
      // 1 无 5 其他
      const currentIsChecked = this.model.diseaseList.includes(value)
      // 当选择无时
      if (value === emptyVal && currentIsChecked) {
        this.model.diseaseList = ["1"]
      } else if (value !== emptyVal) {
        this.model.diseaseList = this.model.diseaseList.filter(v => v > 1)
      }
    }
  }
}
</script>
<style lang="scss" scoped>
.nation {
  // display: flex;
  .el-input {
    margin: 0 30px 0 0;
    // margin-left: 15px;
  }
  .fontColor {
    color: #606266;
    font-weight: 500;
    margin-right: 30px;
  }
}
</style>
